<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>共享设备</title>
    <link href="__PUBLIC__/FrontEnd/css/style.css" type="text/css" rel="stylesheet">
    <script>
//        function a1(){
//            history.go(0) ;
//        }
//        setInterval('a1()',300000);

    </script>
</head>
<body style="background-color: #333">
<p align="right" style="margin-right: 10px">
    <a href="javascript:history.go(-1)">返回上一页</a> 
    <a href="{:U('User/exitLogin')}">注销</a>
</p>
<div class="container">
    <div class="top">
        <br/>
        <h1 align="center">
            楼宇消防监测系统控制平台
        </h1>
        <br/><br/>
    </div>

    <div class="main">
        <foreach name="info" item="v">
            <a href="{:U('Console/detail')}?id={$v.id}&db={$v.devicebyname}&ci={$v.chipid}">
                <div class="device_block">
                    <div class="device_add">
                        <script>
                            if('{$v.devicebyname}'){
                                document.write('<h3 id="deviceadd">{$v.devicebyname}</h3>');
                            }else{
                                document.write('<h3 id="deviceadd">{$v.chipid}</h3>');
                            }
                        </script>

                    </div>
                    <div class="device_sign" style="background: #000;">
                        <img src="__PUBLIC__/FrontEnd/image/{$v.devicestate}.png">
                    </div>

                    <div class="device_info" id="device_info">
                        <script>
                            if("{$v.devicetype}" != 1){
                                if("{$v.devicestate}" == "no_fire" || "{$v.devicestate}" == "no_smoke"){
                                    document.write("<p>正常</p>");
                                }
                                if("{$v.devicestate}" == "fire"){
                                    document.write("<p>火灾报警</p>");
                                }
                                if("{$v.devicestate}" == "smoke")
                                {
                                    document.write("<p>烟雾报警</p>");
                                }

                            }else{
                                document.write('<form  method="post" action="../../../Console.php?id={$v.id}&f=0">'+
                                '<button type="submit" name="led"  value="LED1">打开</button>&nbsp;&nbsp;'+
                                '<button type="submit" name="led" value="LED0">关闭</button><br/>'+
                                '</form>');

                            }
                        </script>
                    </div>
                </div>
            </a>
        </foreach>
        <?php

                for($i=0;$i<$num;$i++){
                    $arr=mysql_fetch_assoc($result);
                    echo '<a href="detial.php?dAdd='.$arr['deviceAdd'].'&id='.$arr['id'].'">
                    <div class="device_block">
                        <div class="device_add">
                            <h3 id="deviceadd">'.$arr['deviceAdd'].'</h3>
                        </div>
                        <div class="device_sign">';
                            if($arr['deviceState']=="open"){
                            //echo '<i class="fa fa-play-circle fa-3x" style="color: red; background-color: transparent;"></i>';
                            echo "<h2 style='color:yellow;'>Running......</h2>";
                            }else{
                            echo "<h2 style='color:black;'>Stop......</h2>";
                            //echo '<i class="fa fa-stop-circle fa-3x"></i>';
                            }



                            echo '</div>
                        <div class="device_info">
                            <form  method="post" action="Console.php?id='.$arr['id'].'&f=0">
                                <button type="submit" name="led"  value="LED1">打开</button>
                                <button type="submit" name="led" value="LED0">关闭</button><br/>
                            </form>

                        </div>
                    </div></a>';
                }



        ?>

    </div>

    <div class="foot">
        <p>Copyright © 1996 - 2016 w &amp; c. All Rights Reserved.</p>
        <p>Powered By:lauwen &amp; cc.</p>
    </div>

</div>


</body>
</html>

<!--$openled = "LED1";-->
<!--//$closeled = "LED0";-->
<!--//$mot = "LEFT";-->
<!--$motor = array(0=>"RIGHT",1=>"LEFT",2=>"STOP");-->
